package supermarket1;

public class Phone2 {
    //TODO 用组合的方法同样可以使用Merchandise的属性和方法
    // 在该手机类中增加另一个类的引用类型作为自己的属性
    private double screenSize;
    private double cpuHZ;
    private int memoryG;
    private int storageG;
    private String brand;
    private String os;
    private Merchandise merchandise;

    public Phone2(double screenSize,double cpuHZ,int memoryG,int storageG,String brand,String os,Merchandise merchandise){
        this.screenSize=screenSize;
        this.cpuHZ=cpuHZ;
        this.memoryG=memoryG;
        this.storageG=storageG;
        this.brand=brand;
        this.os=os;
        this.merchandise=merchandise;
    }
    public void describePhone(){
        System.out.println("此手机的商品属性如下");
        merchandise.describe();
        System.out.println("手机厂商为"+brand+"；系统为"+os+"；屏幕为"+screenSize);
    }

    public Merchandise getMerchandise(){
        return this.merchandise;
    }
}
